home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / progba_1 / ctlprogb.ctl next >
Text File  |  1999-01-05  |  36KB  |  881 lines

  1. VERSION 5.00
  2. Begin VB.UserControl ProgBar 
  3.    Alignable       =   -1  'True
  4.    BackColor       =   &H00FFFFFF&
  5.    CanGetFocus     =   0   'False
  6.    ClientHeight    =   1290
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   4425
  10.    ClipControls    =   0   'False
  11.    FillColor       =   &H00FF0000&
  12.    BeginProperty Font 
  13.       Name            =   "Arial"
  14.       Size            =   8.25
  15.       Charset         =   0
  16.       Weight          =   400
  17.       Underline       =   0   'False
  18.       Italic          =   0   'False
  19.       Strikethrough   =   0   'False
  20.    EndProperty
  21.    ForeColor       =   &H00FF0000&
  22.    ScaleHeight     =   86
  23.    ScaleMode       =   3  'Pixel
  24.    ScaleWidth      =   295
  25.    ToolboxBitmap   =   "ctlProgBar.ctx":0000
  26. End
  27. Attribute VB_Name = "ProgBar"
  28. Attribute VB_GlobalNameSpace = False
  29. Attribute VB_Creatable = True
  30. Attribute VB_PredeclaredId = False
  31. Attribute VB_Exposed = False
  32. '===========================================================
  33. '= ProgBar Control V1.2.1                                  =
  34. '= ----------------------                                  =
  35. '= (C)1998 NE                                              =
  36. '= NE94252@netscape.net                                    =
  37. '=                                                         =
  38. '= You may use this source code within your own            =
  39. '= applications.  You may not distribute it on a website   =
  40. '= or ftp site without my express permission.              =
  41. '===========================================================
  42. '= Updates:                                                =
  43. '= --------                                                =
  44. '= V1.1          - Addition of the VerticalText property.  =
  45. '=               - General code clean up.                  =
  46. '=               - Addition of the ability to play a wav   =
  47. '=                 file at 100%.                           =
  48. '= V1.2          - Addition of gradient fill (BarStyle).   =
  49. '=               - All bar and background drawing handled  =
  50. '=                 by APIs to speed things up.             =
  51. '=               - The ability to wait for the sound to    =
  52. '=                 finish or not before realsing to code.  =
  53. '= V1.2.1        - Fixed a problem with the use of         =
  54. '=                 reserved words.                         =
  55. '===========================================================
  56. '= RunTime Properties: (Aphabetical order)                 =
  57. '= -------------------                                     =
  58. '= BackColour    - The back ground colour of the bar.      =
  59. '=                 Standard colour range.                  =
  60. '= BarEndColour  - The colour the bar fades into when the  =
  61. '=                 'BarStyle' is Gradient.                 =
  62. '=                 Standard colour range.                  =
  63. '= BarStartColour- The colour the bar fades from or the    =
  64. '=                 colour of the bar if the 'BarStyle' is  =
  65. '=                 Solid. Standard colour range.           =
  66. '= BarStyle      - The style of bar fill (gradient or      =
  67. '=                 solid).                                 =
  68. '=                 0 = Gradiant, 1 = Solid.                =
  69. '= BorderStyle   - Standard border style.                  =
  70. '=                 0 = Flat, 1 = ThreeD                    =
  71. '= FillDirection - The direction the bar should fill.      =
  72. '=                 0 = Up, 1 = Down, 2 = Left, 3 = Right   =
  73. '= FontColour    - The colour of the text displayed.       =
  74. '=                 Standard colour range.                  =
  75. '= Max           - The upper limit of the bar.             =
  76. '=                 Long value, -2147483648 to 2147483647   =
  77. '= Message       - The message to display in the bar.      =
  78. '=                 String.                                 =
  79. '= Min           - The lower limit of the progress bar.    =
  80. '=                 Long value, -2147483648 to 2147483647   =
  81. '= Percent       - The current bar percentage.             =
  82. '=                 Byte value, 0 to 100 (obviously :))     =
  83. '= PlaySound     - Flag to indicate the sound file         =
  84. '=                 specified in the SoundToPlay property   =
  85. '=                 sould be played when 100% is reached.   =
  86. '=                 (TRUE, FALSE)                           =
  87. '= ShowMessage   - Flag to indicate the message should be  =
  88. '=                 shown. (TRUE, FALSE)                    =
  89. '= ShowPercent   - Flag to incicate the current percentage =
  90. '=                 should be shown. (TRUE, FALSE)          =
  91. '= ShowValue     - Flag to indicate the current value      =
  92. '=                 should be shown. (TRUE, FALSE)          =
  93. '= SoundToPlay   - A string value holding the path and     =
  94. '=                 name of the wav file to play @ 100%.    =
  95. '= Value         - The current value of the progress bar.  =
  96. '=                 Long value, -2147483648 to 2147483647   =
  97. '= VerticalText  - Flag to indicate that the text should   =
  98. '=                 be written top to bottom, useful for up =
  99. '=                 or down progress bars. (TRUE, FALSE)    =
  100. '= WaitForSound  - This flag indicates that the code will  =
  101. '=                 susspend until the sound file played at =
  102. '=                 100% has finished playing.  If one's    =
  103. '=                 set to play that is. (TRUE, FALSE)      =
  104. '===========================================================
  105. '= Notes:                                                  =
  106. '= ------                                                  =
  107. '= 1. You can either show the percentage or value or       =
  108. '=    neither.  You can't show both.  Setting one will     =
  109. '=    disable the other.                                   =
  110. '= 2. Setting the value above the 'Max' or below the 'Min' =
  111. '=    will result in the value being set to the 'Max' or   =
  112. '=    'Min'.                                               =
  113. '= 3. Setting the percent above 100 or below 0 will result =
  114. '=    in the percentage being changed.                     =
  115. '= 4. Setting the 'Max' below the 'Min' will result in the =
  116. '=    'Max' being set to the 'Min' + 1.                    =
  117. '= 5. Setting the 'Min' below the 'Max' will result in the =
  118. '=    'Min' being set to the 'Max' - 1.                    =
  119. '= 6. Adjusting either the 'Max' or the 'Min' will cause   =
  120. '=    the 'Value' to be recalculated.                      =
  121. '= 7. If the 'BarStyle' is set to solid the colour of the  =
  122. '=    bar is defined by the 'BarStartColour' property.     =
  123. '= 8. If a sound is playing and the flag to play one at    =
  124. '=    100% is set the currently playing file will stop and =
  125. '=    the specified one will play.                         =
  126. '===========================================================
  127. '= Have fun! NE                                            =
  128. '===========================================================
  129.  
  130. Option Explicit
  131. 'API and constant to play wav file.
  132. Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
  133. Private Const SND_SYNC = &H0
  134. Private Const SND_ASYNC = &H1
  135. 'API's, type and constants for the bar fills.
  136. Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
  137. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  138. Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
  139. Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  140. Private Type RECT
  141.     vLeft    As Long
  142.     vTop     As Long
  143.     vRight   As Long
  144.     vBottom  As Long
  145. End Type
  146. Private Const PLANES = 14
  147. Private Const BITSPIXEL = 12
  148. 'Fill direction list.
  149. Public Enum FillDirection
  150.     pbUp
  151.     pbDown
  152.     pbLeft
  153.     pbRight
  154. End Enum
  155. 'Border style list.
  156. Public Enum BorderStyles
  157.     pbNone
  158.     pbFixedSingle
  159. End Enum
  160. 'Appearance style list.
  161. Public Enum AppearanceStyles
  162.     pbFlat
  163.     pbThreeD
  164. End Enum
  165. 'Bar style list.
  166. Public Enum BarStyle
  167.     pbGradient
  168.     pbSolid
  169. End Enum
  170.